/*
 * @Author: hc
 * @Date: 2024-03-05 19:36:52
 * @LastEditTime: 2024-03-05 20:55:45
 * @LastEditors: hc
 * @Description: 工具类
 */
export var getCursorPosition = function getCursorPosition(ctrl) {
  var _ctrl$resizableTextAr, _ctrl$resizableTextAr3;
  var CaretPos = {
    start: 0,
    end: 0
  };
  if (ctrl !== null && ctrl !== void 0 && (_ctrl$resizableTextAr = ctrl.resizableTextArea) !== null && _ctrl$resizableTextAr !== void 0 && _ctrl$resizableTextAr.textArea.selectionStart) {
    var _ctrl$resizableTextAr2;
    CaretPos.start = ctrl === null || ctrl === void 0 || (_ctrl$resizableTextAr2 = ctrl.resizableTextArea) === null || _ctrl$resizableTextAr2 === void 0 ? void 0 : _ctrl$resizableTextAr2.textArea.selectionStart;
  }
  if (ctrl !== null && ctrl !== void 0 && (_ctrl$resizableTextAr3 = ctrl.resizableTextArea) !== null && _ctrl$resizableTextAr3 !== void 0 && _ctrl$resizableTextAr3.textArea.selectionEnd) {
    var _ctrl$resizableTextAr4;
    CaretPos.end = ctrl === null || ctrl === void 0 || (_ctrl$resizableTextAr4 = ctrl.resizableTextArea) === null || _ctrl$resizableTextAr4 === void 0 ? void 0 : _ctrl$resizableTextAr4.textArea.selectionEnd;
  }
  return CaretPos;
};
export var setCursorPosition = function setCursorPosition(ctrl, start, end) {
  ctrl.focus();
  ctrl.resizableTextArea.textArea.setSelectionRange(start, end);
};